package com.neusoft.elm.service.Impl;

import com.neusoft.elm.dao.FoodDao;
import com.neusoft.elm.dao.impl.FoodDaoImpl;
import com.neusoft.elm.po.Food;
import com.neusoft.elm.service.FoodService;
import com.neusoft.elm.util.DBUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 食品方法实现
 * Service
 */
public class FoodServiceImpl implements FoodService {

    /**
     * 根据商家ID列出食品
     *
     * @param businessId
     * @return
     * @throws Exception
     */
    @Override
    public List<Food> listFoodByBusinessId(Integer businessId) {
        List<Food>list = new ArrayList<>();
        FoodDao dao = new FoodDaoImpl();
        try{
            DBUtil.getConnection();
            list = dao.listFoodByBusinessId(businessId);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            DBUtil.close();
        }
        return list;
    }
}
